$(document).ready(function(){
	var user_class = $('#user_class').val();
	checkCustClass(user_class)
});

function checkCustClass(val) {
	$.ajax({
   type: "POST",
   url: "/program/admin/personallevel/checkUserClass.jsp",
   data: "user_class="+val,
   success: function(response){
     $('#hiddenCustData').html(response); 
	 if($('#checkCustDataRemote').text() == "1"){
		$('#alertCheckMessage').css('display','');
	 }else{
		$('#alertCheckMessage').css('display','none');
	 }
   }
 });
}
function subForm(){

		if(document.getElementById('user_class').value==""){

				alert('请输入级别编号！');

				document.getElementById('user_class').focus();

				return false;

			}

		if(document.getElementById('class_name').value==""){

				alert('请输入级别名称！');

				document.getElementById('class_name').focus();

				return false;

			}		
  if($('#checkCustDataRemote').text() == "1"){
	alert("级别编号已存在，请重新输入!");
	document.getElementById('user_class').focus();
	return false;
	}
     document.addForm.submit();

   
}
function isNum(){
		if(isNaN(document.getElementById("user_class").value)){

				alert('级别编号必须是数字！');
				document.getElementById("user_class").value="";
				document.getElementById("user_class").focus();
				return false;

			}
					if(isNaN(document.getElementById(class_name).value)){

				alert('级别折扣率必须是数字！');
				document.getElementById("class_name").value="";
				document.getElementById("class_name").focus();
				return false;

			}
					if(isNaN(document.getElementById("up_num").value)){

				alert('积分上限必须是数字！');
				document.getElementById("up_num").value="";
				document.getElementById("up_num").focus();
				return false;

			}
					if(isNaN(document.getElementById("down_num").value)){

				alert('积分下限必须是数字！');
				document.getElementById("down_num").value="";
				document.getElementById("down_num").focus();
				return false;

			}
				
	}
function searchForm(){
	 document.indexForm .submit();
}
 

 